﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.Xna.Framework.Graphics;
using System.Windows.Threading;
using Microsoft.Xna.Framework;

namespace ModelViewer
{
    /// <summary>
    /// Interaction logic for Info.xaml
    /// </summary>
    public partial class Info : Window
    {
        delegate void HideMe();

        public Info()
        {
            InitializeComponent();
        }

        public void Setup(Model model, BoundingSphere sphere)
        {
            meshCountLabel.Content = model.Meshes.Count;
            boneCountLabel.Content = model.Bones.Count;
            rootBoneLabel.Content = model.Root.Name;
            bsCenterLabel.Content = "X: " + sphere.Center.X + "  Y: " + sphere.Center.Y + "  Z: " + sphere.Center.Z;
            bsRadiusLabel.Content = sphere.Radius;
        }

        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            e.Cancel = true;

            // Don't close just hide the window
            Dispatcher.BeginInvoke(DispatcherPriority.Normal, new HideMe(this.HideWindow));
        }

        void HideWindow()
        {
            this.Hide();
        }
    }
}
